require(['../config'],()=>{
	require(['swiper','template','jcookie','jquery','Header','footer'],(swiper,template,jcookie)=>{
		class Login{
			constructor() {
			    this.into()
			}
			into(){
				$('.login-btn').on('click',()=>{
				if($('.phone-num').val() === ''){
					alert('请输入完整信息')
				}else if($('.user-pwd').val() === ''){
					alert('请输入完整信息')
				}else{
					this.go()
				}
				})
			}
			
			go(){
					const phone = $('.phone-num').val()
					const pwd = $('.user-pwd').val()
					let ff = localStorage.getItem('ff')
					ff = JSON.parse(ff)
					const isExist = ff.some((gg)=>{
						return gg.phone === phone && gg.pwd === pwd
								
					})
					if(isExist){
						$.cookie('name',phone,{path: '/'})
						alert('登录成功')
						location.href="http://localhost:5200/"
					}else{
						alert('该用户未注册，请先注册')
					}
			}
		}
		new Login()
	})
})
